<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCustomerTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('customer', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('create_id')->unsigned()->default(0)->comment('创建用户');
            $table->bigInteger('follow_id')->unsigned()->default(0)->comment('跟进人');
            $table->string('contact_name')->default('')->comment('客户姓名');
            $table->string('contact_mobile', 100)->default('')->comment('联系电话');
            $table->string('company_name')->default('')->comment('公司名称');
            $table->string('company_position')->default('')->comment('客户职位');
            $table->string('company_desc', 500)->default('')->comment('客户简介');
            $table->string('wechat')->default('')->comment('客户微信');
            $table->smallInteger('from')->default(0)->comment("客户来源");
            $table->tinyInteger('level')->default(0)->comment('客户级别');
            $table->bigInteger('province')->default(0)->comment('省份ID');
            $table->bigInteger('city')->default(0)->comment('城市ID');
            $table->string('address')->default(0)->comment('公司地址');
            $table->tinyInteger('status')->unsigned()->default(0)->comment('是否有效');
            $table->tinyInteger('in_sea')->unsigned()->default(0)->comment('是否在公海里');
            $table->tinyInteger('is_order')->unsigned()->default(0)->comment('是否成单');
            $table->tinyInteger('assigned')->unsigned()->default(0)->comment('是否分配');
            $table->timestamp('assigned_at')->nullable()->comment('分配时间');
            $table->text('remark')->comment('备注');
            $table->timestamp('add_wechat_at')->nullable()->comment('添加微信时间');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('customer');
    }
}
